home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <!-- ===========================================================
- Category: XMLtoXML
- Sub-category: ElemToAttr
- Author: David Silverlight
- HeadGeek@xmlpitstop.com
- Created: 2001-05-16
- Description:-
- This stylsheet will convert an xml file that is
- element-based to one that is attribute-based. In this
- stylesheet, the original customer elements will be
- transformed to attributes.
- ================================================================ -->
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="xml"/>
-
- <xsl:template match="/">
- <xsl:element name="customers">
- <xsl:for-each select="/customers/customer" >
- <xsl:element name='{name()}'>
- <xsl:for-each select="*" >
- <xsl:attribute name='{name()}'> <xsl:value-of select="."/></xsl:attribute>
- </xsl:for-each>
- </xsl:element>
- </xsl:for-each>
- </xsl:element>
-
- </xsl:template>
-
-
- </xsl:stylesheet>